<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-teachAssessMonth-edit" th:object="${teachAssessMonth}">
            <input id="id" name="id" th:field="*{id}"  type="hidden">
			<input id="classId" name="classId" th:field="*{classId}" type="hidden">

			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">考核月份：</label>
					<div class="col-sm-8 input-group">
						<input id="assessMonth" name="assessMonth" th:field="*{assessMonth}" class="form-control" type="text">
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">班级编号：</label>
					<div class="col-sm-8 input-group">
						<!--<input id="classId" name="classId" th:field="*{classId}" class="form-control" type="text">-->
						<input class="form-control" type="text" name="className" onclick="selectList()" readonly="true" id="className" th:field="*{classes.className}">
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">考勤大于等于：</label>
					<div class="col-sm-8 input-group">
						<input id="attendanceOne" name="attendanceOne" required="required" th:field="*{attendanceOne}" class="form-control" type="text" placeholder="例如：50%或者0">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">考勤大于等于计算标准：</label>
					<div class="col-sm-8 input-group">
						<input id="attendanceOneStandard" name="attendanceOneStandard" required="required" th:field="*{attendanceOneStandard}" class="form-control" type="text" placeholder="例如：50%或者0">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">考勤大于等于-考勤小于：</label>
					<div class="col-sm-8 input-group">
						<input id="attendanceTwo" name="attendanceTwo" required="required" th:field="*{attendanceTwo}" class="form-control" type="text" placeholder="例如：50%-80%">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">考勤在两者之间计算标准：</label>
					<div class="col-sm-8 input-group">
						<input id="attendanceTwoStandard" name="attendanceTwoStandard" required="required" th:field="*{attendanceTwoStandard}" class="form-control" type="text" placeholder="例如：50%或者0">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">考勤小于：</label>
					<div class="col-sm-8 input-group">
						<input id="attendanceThree" name="attendanceThree" required="required" th:field="*{attendanceThree}" class="form-control" type="text" placeholder="例如：50%或者0">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">考勤小于计算标准：</label>
					<div class="col-sm-8 input-group">
						<input id="attendanceThreeStandard" name="attendanceThreeStandard" required="required" th:field="*{attendanceThreeStandard}" class="form-control" type="text" placeholder="例如：50%或者0">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">考试大于等于：</label>
					<div class="col-sm-8 input-group">
						<input id="examOne" name="examOne" required="required" th:field="*{examOne}" class="form-control" type="text" placeholder="例如：50%或者0">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">考试大于等于计算标准：</label>
					<div class="col-sm-8 input-group">
						<input id="examOneStandard" name="examOneStandard" required="required" th:field="*{examOneStandard}" class="form-control" type="text" placeholder="例如：50%或者0">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">考试大于等于-考试小于：</label>
					<div class="col-sm-8 input-group">
						<input id="examTwo" name="examTwo" required="required" th:field="*{examTwo}" class="form-control" type="text" placeholder="例如：50%-80%">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">考试在两者之间计算标准：</label>
					<div class="col-sm-8 input-group">
						<input id="examTwoStandard" name="examTwoStandard" required="required" th:field="*{examTwoStandard}" class="form-control" type="text" placeholder="例如：50%或者0">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">考试小于：</label>
					<div class="col-sm-8 input-group">
						<input id="examThree" name="examThree" required="required" th:field="*{examThree}" class="form-control" type="text" placeholder="例如：50%或者0">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">考试小于计算标准：</label>
					<div class="col-sm-8 input-group">
						<input id="examThreeStandard" name="examThreeStandard" required="required" th:field="*{examThreeStandard}" class="form-control" type="text" placeholder="例如：50%或者0">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">作业大于等于：</label>
					<div class="col-sm-8 input-group">
						<input id="taskOne" name="taskOne" required="required" th:field="*{taskOne}" class="form-control" type="text" placeholder="例如：50%或者0">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">作业大于等于计算标准：</label>
					<div class="col-sm-8 input-group">
						<input id="taskOneStandard" name="taskOneStandard" required="required" th:field="*{taskOneStandard}" class="form-control" type="text" placeholder="例如：50%或者0">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">作业大于等于-作业小于：</label>
					<div class="col-sm-8 input-group">
						<input id="taskTwo" name="taskTwo" required="required" th:field="*{taskTwo}" class="form-control" type="text" placeholder="例如：50%-80%">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">作业在两者之间计算标准：</label>
					<div class="col-sm-8 input-group">
						<input id="taskTwoStandard" name="taskTwoStandard" required="required" th:field="*{taskTwoStandard}" class="form-control" type="text" placeholder="例如：50%或者0">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">作业小于：</label>
					<div class="col-sm-8 input-group">
						<input id="taskThree" name="taskThree" required="required" th:field="*{taskThree}" class="form-control" type="text" placeholder="例如：50%或者0">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">作业小于计算标准：</label>
					<div class="col-sm-8 input-group">
						<input id="taskThreeStandard" name="taskThreeStandard" required="required" th:field="*{taskThreeStandard}" class="form-control" type="text" placeholder="例如：50%或者0">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">项目大于等于：</label>
					<div class="col-sm-8 input-group">
						<input id="subjectOne" name="subjectOne" required="required" th:field="*{subjectOne}" class="form-control" type="text" placeholder="例如：50%或者0">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">项目大于等于计算标准：</label>
					<div class="col-sm-8 input-group">
						<input id="subjectOneStandard" name="subjectOneStandard" required="required" th:field="*{subjectOneStandard}" class="form-control" type="text" placeholder="例如：50%或者0">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">项目大于等于-项目小于：</label>
					<div class="col-sm-8 input-group">
						<input id="subjectTwo" name="subjectTwo" required="required" th:field="*{subjectTwo}" class="form-control" type="text" placeholder="例如：50%-80%">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">项目在两者之间计算标准：</label>
					<div class="col-sm-8 input-group">
						<input id="subjectTwoStandard" name="subjectTwoStandard" required="required" th:field="*{subjectTwoStandard}" class="form-control" type="text" placeholder="例如：50%或者0">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">项目小于：</label>
					<div class="col-sm-8 input-group">
						<input id="subjectThree" name="subjectThree" required="required" th:field="*{subjectThree}" class="form-control" type="text" placeholder="例如：50%或者0">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group">
					<label class="col-sm-3 control-label">项目小于计算标准：</label>
					<div class="col-sm-8 input-group">
						<input id="subjectThreeStandard" name="subjectThreeStandard" required="required" th:field="*{subjectThreeStandard}" class="form-control" type="text" placeholder="例如：50%或者0">
						<span class="input-group-addon" style="background-color: #EEEEEE">%</span>
					</div>
				</div>
			</div>
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "teach/teachAssessMonth";
		$("#form-teachAssessMonth-edit").validate({
			rules:{
				xxxx:{
					required:true,
				},
			}
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
                edit();
	        }
	    }

	    function edit() {
            var id = $("input[name='id']").val();
            var classId = $("#classId").val();
            var assessMonth = $("input[name='assessMonth']").val();
            /*assessMonth =  assessMonth.replace(/-/g,"/");
            //// str =  str.replace("T"," ");
            var oDate1 = new Date(assessMonth);
            console.log(oDate1);*/
            var attendanceOne = $("input[name='attendanceOne']").val();
            var attendanceOneStandard = $("input[name='attendanceOneStandard']").val();
            var attendanceTwo = $("input[name='attendanceTwo']").val();
            var attendanceTwoStandard = $("input[name='attendanceTwoStandard']").val();
            var attendanceThree = $("input[name='attendanceThree']").val();
            var attendanceThreeStandard = $("input[name='attendanceThreeStandard']").val();
            var examOne = $("input[name='examOne']").val();
            var examOneStandard = $("input[name='examOneStandard']").val();
            var examTwo = $("input[name='examTwo']").val();
            var examTwoStandard = $("input[name='examTwoStandard']").val();
            var examThree = $("input[name='examThree']").val();
            var examThreeStandard = $("input[name='examThreeStandard']").val();
            var taskOne = $("input[name='taskOne']").val();
            var taskOneStandard = $("input[name='taskOneStandard']").val();
            var taskTwo = $("input[name='taskTwo']").val();
            var taskTwoStandard = $("input[name='taskTwoStandard']").val();
            var taskThree = $("input[name='taskThree']").val();
            var taskThreeStandard = $("input[name='taskThreeStandard']").val();
            var subjectOne = $("input[name='subjectOne']").val();
            var subjectOneStandard = $("input[name='subjectOneStandard']").val();
            var subjectTwo = $("input[name='subjectTwo']").val();
            var subjectTwoStandard = $("input[name='subjectTwoStandard']").val();
            var subjectThree = $("input[name='subjectThree']").val();
            var subjectThreeStandard = $("input[name='subjectThreeStandard']").val();
            $.ajax({
                cache : true,
                type : "POST",
                url : prefix + "/edit",
                data : {
                    "id": id,
                    "classId": classId,
                    "assessMonth": assessMonth,
                    "attendanceOne": attendanceOne,
                    "attendanceOneStandard": attendanceOneStandard,
                    "attendanceTwo": attendanceTwo,
                    "attendanceTwoStandard": attendanceTwoStandard,
                    "attendanceThree": attendanceThree,
					"attendanceThreeStandard":attendanceThreeStandard,
                    "examOne": examOne,
                    "examOneStandard": examOneStandard,
                    "examTwo": examTwo,
                    "examTwoStandard": examTwoStandard,
                    "examThree": examThree,
                    "examThreeStandard": examThreeStandard,
                    "taskOne": taskOne,
                    "taskOneStandard": taskOneStandard,
                    "taskTwo": taskTwo,
                    "taskTwoStandard": taskTwoStandard,
                    "taskThree": taskThree,
                    "taskThreeStandard": taskThreeStandard,
                    "subjectOne": subjectOne,
                    "subjectOneStandard": subjectOneStandard,
                    "subjectTwo": subjectTwo,
                    "subjectTwoStandard": subjectTwoStandard,
                    "subjectThree": subjectThree,
                    "subjectThreeStandard": subjectThreeStandard
                },
                async : false,
                error : function(request) {
                    $.modal.alertError("系统错误");
                },
                success : function(data) {
                    $.operate.successCallback(data);
                }
            });
        }

        //年月选择器
        laydate.render({
            elem: '#assessMonth'
            ,type: 'month',trigger: 'click'
        });

        /*月度考核-新增-选择班级*/
        function selectList() {
            var url = ctx + "teach/teachClasses/selectList";
            var options = {
                title: '选择班级',
                width: "800",
                url: url,
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }

        function doSubmit(index, layero){
            var body = layer.getChildFrame('body', index);
            var data = body.find('.selected')[0];
            if(data != "undefined" && data != "" && data != null){
                $("#className").val(body.find('.selected')[0].children[2].innerHTML);
                $("#classId").val(body.find('.selected')[0].children[1].innerHTML);
            }else{
                layer.msg("请选择一个班级");
            }
            layer.close(index);
        }
	</script>
</body>
</html>
